package payment

import "fmt"

// 微信支付
type WechatPay struct {
}

func NewWechatPay() *WechatPay {
	return &WechatPay{}
}

// 支付方法
func (w *WechatPay) Pay(amount int64) (string, error) {
	fmt.Printf("wechat pay %d\n", amount)
	return fmt.Sprintf("wechat pay %d", amount), nil
}

// 风控检查
func (w *WechatPay) RiskCheck(amount int64) bool {
	fmt.Printf("wechat risk check %d\n", amount)
	return true
}

// 退款方法
func (w *WechatPay) Refund(orderId string) error {
	fmt.Printf("wechat refund %s\n", orderId)
	return nil
}

// WechatPayFactory 微信支付网关工厂
type WechatPayFactory struct {
}

func NewWechatPayFactory() *WechatPayFactory {
	return &WechatPayFactory{}
}

func (w *WechatPayFactory) Create() Payment {
	return NewWechatPay()
}
